package com.qdu.servlet;

import com.qdu.entity.Employee;
import java.util.List;
import com.qdu.dao.impl.EmployeeDaoImpl;
import com.qdu.service.EmployeeService;

/**
 * EmployeeService接口的实现类，包含了员工相关业务功能的实现
 *
 * @author Anna
 */
public class EmployeeServiceImpl implements EmployeeService {

    EmployeeDaoImpl employeeDao = new EmployeeDaoImpl() {
        public int update(Employee e) {
            throw new UnsupportedOperationException("Not supported yet."); //To change body of generated methods, choose Tools | Templates.
        }
    };


    @Override
    public Employee findEmployeeById(String empId) {
        return employeeDao.getOneById(empId);
    }

    @Override
    public int addNewEmployee(Employee emp) {
        return employeeDao.insert(emp);
    }

    @Override
    public int modifyEmployeeInfo(Employee emp) {
        return employeeDao.update(emp);
    }
    
    @Override
    public int modifyEmployeePhoto(String empId, String photo) {
        return employeeDao.updatePhoto(empId, photo);
    }

    @Override
    public int deleteEmployee(String empId) {
        return employeeDao.deleteById(empId);
    }

    @Override
    public List<Employee> findAllEmployees() {
        return employeeDao.getAll();
    }
}
